<?php
$Notice = Dracosys::getSessionValue(SESSION_INTERFACE, 'NoticeEdit');
$ArSetores = Dracosys::getSessionValue(SESSION_INTERFACE, 'SectorsList');
$ArCategorias = Dracosys::getSessionValue(SESSION_INTERFACE, 'CategoriesList');
?>
<h2>Editar Aviso</h2>
<section id="EditNotice">
    <form method="post" action="funcao/atualizar" name="FormEditarAviso">
        <section id="EditNotice_Dados" class="section-update">
            <div class="out_txt big"><label for="EditNotice_StTitulo">T&iacute;tulo</label></div>
            <div class="inp_txt big"><input type="text" name="StTitulo" id="EditNotice_StTitulo" value="<?=$Notice->getStTitulo()?>" /></div>
            <div class="out_txt big"><label for="EditNotice_IDCategoria">Categoria</label></div>
            <div class="inp_txt big">
                <select name="" id="EditNotice_IDCategoria">
                    <?php
                    foreach($ArCategorias as $Categoria):
                        $StSelected = $Categoria->equals($Notice->getCategoria()) ? 'selected' : '';
                        echo "<option value=\"{$Categoria->getIDCategoria()}\" {$StSelected}>{$Categoria->getStCategoria()}</option>";
                     endforeach;
                     ?>
                </select>
            </div>
            <div class="out_txt big"><label for="EditNotice_IDSetor">Setor</label></div>
            <div class="inp_txt big">
                <select name="" id="EditNotice_IDSetor">
                    <option value="TODOS">Todos</option>
                    <?php
                    foreach($ArSetores as $Setor):
                        if( !$Notice->isPublic() ):
                            $StSelected = $Setor->equals( $Notice->getSetor() ) ? 'selected' : '';
                        endif;
                        echo "<option value=\"{$Setor->getIDSetor()}\" {$StSelected}>{$Setor->getStNome()}</option>";
                    endforeach; ?>
                </select>
            </div>
            <div class="out_txt big textarea"><label for="EditNotice_TxAviso">Conteúdo</label></div>
            <div class="inp_txt big textarea"><textarea id="EditNotice_TxAviso"><?=$Notice->getTxAviso()?></textarea></div>
            <div class="out_txt big"><label for="EditNotice_DtInicio">Iniciar em</label></div>
            <div class="inp_txt big"><input type="text" name="DtInicio" id="EditNotice_DtInicio" value="<?= dateBDtoBR($Notice->getDtInicio()) ?>" class="Date" /></div>
            <div class="out_txt big"><label for="EditNotice_DtDesativar">Desativar em</label></div>
            <div class="inp_txt big"><input type="text" name="DtDesativar" id="EditNotice_DtDesativar" value="<?= dateBDtoBR($Notice->getDtDesativar()) ?>" class="Date" /></div>
        </section>
        <div class="btn"><button class="v1">Atualizar</button></div>
        <input type="hidden" name="IDAviso" value="<?=treatUrl('id')?>" id="EditNotice_IDAviso" />
    </form>
</section>